<template>
 <div>
     <header @click="$router.go(-1)">人气推荐</header>
     <ul>
         <li v-for="item in list" :key="item.id" @click="$router.push('/Detail?id='+item.id)">
             <img :src="item.pic" alt="">
             <p>{{item.name}}</p>
             <span>￥{{item.minPrice}}</span>
         </li>
     </ul>
 </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      list: []
    };
  },
  mounted() {
    this.getList();
  },
  methods: {
    async getList() {
      let { data: res } = await this.$http.get(
        "https://api.it120.cc/small4/shop/goods/list"
      );
      console.log(res);
      this.list = res.data;
    }
  },
  computed: {},
  watch: {}
};
</script>

<style scoped>
header {
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-align: center;
  background-color: white;
  position: fixed;
  top: 0;
  left: 0;
}
ul {
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 50px;
}
li {
  list-style: none;
  width: 48%;
  height: 266px;
}
ul > li > img {
  width: 168px;
  height: 216px;
}
span {
  color: red;
}
</style>